from marshmallow import fields
from gis.common.django_ext.forms import PaginationSchema, BaseSchema, EnumField
from itpay.core.agency.const import AgencyOrderStatusType


class ChildAgencyRechargeOrderListSchema(PaginationSchema):
    id = fields.Integer()
    status = EnumField(AgencyOrderStatusType)
    agency_id = fields.Integer()
    agency_name = fields.String()
    created_at_begin = fields.DateTime()
    created_at_end = fields.DateTime()
    updated_at_begin = fields.DateTime()
    updated_at_end = fields.DateTime()


class MyRechargeOrderListSchema(PaginationSchema):
    id = fields.Integer()
    status = EnumField(AgencyOrderStatusType)
    created_at_begin = fields.DateTime()
    created_at_end = fields.DateTime()
    updated_at_begin = fields.DateTime()
    updated_at_end = fields.DateTime()


class MyRechargeOrderAddSchema(BaseSchema):
    amount = fields.Integer(required=True)


class RechargeReportListSchema(PaginationSchema):
    mch_id = fields.Integer()
    agency_id = fields.Integer()
    agency_name = fields.String()
    updated_at_start = fields.DateTime()
    updated_at_end = fields.DateTime()


class TtlRechargeReportSchema(BaseSchema):
    mch_id = fields.Integer()
    agency_id = fields.Integer()
    agency_name = fields.String()


class AgencyOrderChangeStatusSchema(BaseSchema):
    reason = fields.String(missing='')
